<?php 

// var_dump($_FILES);

if($_POST){

	$key = key($_FILES);

	if(!is_array($_FILES[$key]['tmp_name'])){
			Upload($_FILES[$key]['tmp_name']);
	}else{
		foreach ($_FILES[$key]['tmp_name'] as $value) {
			
			Upload($value);
		}
	}

}


function Upload($tmpPath)
{
	if(is_uploaded_file($tmpPath)){
		$dir = './Upload/'.date("Y-m-d").'/';

		!is_dir($dir)? mkdir($dir,777,true) : '' ;

		$path = $dir.uniqid().".jpg";

		move_uploaded_file($tmpPath,$path);
	}
	
}


 ?>

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html lang="en">
 <head>
 	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
 	<title>Document</title>
 	<style type="text/css">
 		body{
 			padding:0px;
 			margin: 0px;
 		}
		.file{
			width: 200px;
			height: 50px;
			opacity: 0;
			position: absolute;
			top: 0px;
			left: 0px;
		}
		.submit{
			/*opacity: 0;*/
		}
		.file_bg{
			width: 200px;
			height: 50px;
			background: #fff url(./images/file.jpg) 0 0 no-repeat;
		}
 	</style>
 </head>
 <body>
 	<div class="file_bg"></div>
 	<form action="" method="post" enctype="multipart/form-data">
 		<input type="hidden" name="MAX_FILE_SIZE" value="1024000">
 		<input class="file" type="file" name="kecheng[]" multiple="true">
 		<input class='submit' type="submit" value="上传">
 	</form>
 	
 </body>
 </html>